package com.quiz.bis.controller;

import com.quiz.bis.domain.model.*;
import com.quiz.bis.service.IStatService;
import com.quiz.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计报表控制器
 */
@RestController
@RequestMapping("/api/stat")
@Tag(name = "统计报表")
@RequiredArgsConstructor
public class StatController {

    private final IStatService statService;

    @GetMapping("/exam")
    @Operation(summary = "获取考试统计数据")
    public R<ExamStatModel> getExamStatistics() {
        return R.ok(statService.getExamStatistics());
    }

    @GetMapping("/paper")
    @Operation(summary = "获取试卷统计数据")
    public R<PaperStatModel> getPaperStatistics() {
        return R.ok(statService.getPaperStatistics());
    }

    @GetMapping("/question")
    @Operation(summary = "获取题目统计数据")
    public R<QuestionStatModel> getQuestionStatistics() {
        return R.ok(statService.getQuestionStatistics());
    }
}